Summary
Affected versions of urijs fails to validate the hostname correctly when using backslash in the protocol e.g. http:\/
.
Browsers accept backslashes after the protocol, and treat it as a normal slash, while urijs sees it as a relative path.
Product
urijs before 1.19.6.
Impact
Depending on library usage and attacker intent, impacts may include allow/block list bypasses, SSRF attacks, open redirects, or other undesired behavior.
Steps to reproduce
1 | var URI = require('urijs'); |
Expected result:
the url would be relative without a hostname:
1 | URI { |
Remediation
Update urijs dependency to 1.19.6 or above.
Credit
This issue was discovered and reported by Checkmarx SCA Security Researcher Yaniv Nizry.
Resources
- Commit a1ad8bc
- Release note
- Advisory